package 多线程.jol;

import lombok.Data;
import org.junit.Test;
import org.openjdk.jol.info.ClassLayout;

import java.util.Date;

@Data
public class MyJavaObjectLayout {
    /**
     * 是否结婚
     */
    private boolean married = true;
    /**
     * 工作经验
     */
    private byte experience = 5;

    /**
     * 体温
     */
    private short temperature = 37;

    private char gender = '男';

    private int age = 18;

    private float weight = 65.5F;

    private double height = 174.5;

    private long id = 10086L;


    private String name = "张三";

    private Date now = new Date();

    private int[] luckyNumbers = {3, 7, 9};
    private Object[] friends = {new Object(), new Object()};

    public static void main(String[] args) {
        String s = ClassLayout.parseInstance(new MyJavaObjectLayout()).toPrintable();
        System.out.println(s);
    }

    @Test
    public void basicArray() {
        String s = ClassLayout.parseInstance(new int[]{3, 7, 9}).toPrintable();
        System.out.println(s);
    }

    @Test
    public void object() {
        String s = ClassLayout.parseInstance(new Object()).toPrintable();
        System.out.println(s);
    }
    @Test
    public void objectArray() {
        String s = ClassLayout.parseInstance(new Object[]{new Object(), new Object(),new Object()}).toPrintable();
        System.out.println(s);
    }

}
